//
//  YZMTradeConfigureModel.h
//  YZMicroStock
//
//  Created by wangminhong on 16/6/3.
//  Copyright © 2016年 cqjr. All rights reserved.
//

#import <Mantle/Mantle.h>

@interface YZMTradeConfigureModel : MTLModel <MTLJSONSerializing>

@property (nonatomic, strong) NSArray *limitTimePeriods;/*交易时间段限制*/
@property (nonatomic, strong) NSString *limitTimeString;/*交易时间段字符串*/
@property (nonatomic, strong) NSArray *showTimePeriods;/*行情时间段，理论上比交易时间段更宽*/
@property (nonatomic, strong) NSDate *requestTime;
@property (nonatomic, assign) BOOL isAllowedTrade;/*运营参数*/
@property (nonatomic, strong) NSString *versionString;/*基础配置的版本*/
@property (nonatomic, strong) NSArray *holidayList;
@property (nonatomic, assign) BOOL isSignAgreement;/*是否已签约协议*/
@property (nonatomic, strong) NSString *token;
@property (nonatomic, assign) double profitShare;//盈利分成
@property (nonatomic, assign) double exchangeRate;//汇率
@property (nonatomic, strong) NSArray *tradeCountList;/*可交易的手数*/
@property (nonatomic, strong) NSArray *quitCloseList;/*止损数组*/
@property (nonatomic, strong) NSArray *quitGainList;/*止盈数组*/
@property (nonatomic, assign) double minFloatPoint;/*最小波动点数*/
@property (nonatomic, assign) double contractValue;/*最小波动对应的盈亏金额*/
@property (nonatomic, assign) double lossRatio;/*止损比例*/
@property (nonatomic, assign) double serviceCharge;/*一手的交易综合费*/
@property (nonatomic, strong) NSString *contractCode;/*合约号*/
@property (nonatomic, assign) double balance;
@property (nonatomic, assign) BOOL isAgreementUpdatd;//合约是否更新
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *moneySymbol;//金钱符号
@property (nonatomic, assign) NSInteger distanceForHour;//美原油，没黄金 与中国时区的差距

- (BOOL)isInTradeTimePeriods;
- (BOOL)isInShowTimePeriods;
- (void)createEncoder;
+ (instancetype)createDecoder;
- (NSArray *)recommandForTradeTime;
- (NSString *)formatPrice:(double)price;
- (NSArray *)getCurrentDatePeriodList;//获取当前时段所处的交易时间大段
- (BOOL)changeDay;//切换天

@end

@interface YZMTradeConfigureModel(private)

- (BOOL)isInHolidayWithDate:(NSDate *)date;
- (BOOL)isInWeekendWithDate:(NSDate *)date;
- (BOOL)isInHolidayOrWeekendWithDate:(NSDate *)date;
- (NSArray *)periodAnalyzeWithString:(NSString *)string;
- (NSArray *)currentTimePeriod;
- (NSString *)nextTradeDay;
- (void)createEncoderWithIdentify:(NSString *)identify;
+ (instancetype)createDecoderWithIdentify:(NSString *)identify;

@end


@interface YZMHangSengConfigureModel : YZMTradeConfigureModel

@end

@interface YZMAmericaConfigureModel : YZMTradeConfigureModel

@end

@interface YZMGoldConfigureModel : YZMAmericaConfigureModel

@end

@interface YZMCrudeConfigureModel : YZMAmericaConfigureModel

@end
